console.log('abc');
let count: number = 1006800;
console.log('count==', count);

class People {
  name = 'yuki';
}

class ChinesePeople extends People {
  age = 18;
}

type demo1 = Extract<ChinesePeople, People>; //ChinesePeople
type demo2 = Extract<People, ChinesePeople>; //never
// console.log('demo1==', demo1);

type Extract<T, U> = T extends U ? T : never; //ts 关于Extract 的底层源码
// type Extract<T, U> = T extends U ? T : boolean; //为了方便理解，临时改写Extract
type unionExtractType = Extract<string, string | number>; //string
type unionExtractType2 = Extract<string | number, string | number>; //string | number
type unionExtractType3 = Extract<string | number, string | number | symbol>; //string | number
type unionExtractType4 = Extract<string | number, string>; //string | boolen

/**
 * unionExtractType4 的分解步骤
 */
// 第一次 string extends string ? T:boolean //结果string
// 第二次 number extends string ? T:boolean //boolean
//所以合起来的结果就是 string | boolen

type func1 = (one: number, two: string) => string;
type func2 = (one: number) => string;
type beginType1 = func1 extends func2 ? func1 : never; //never
type beginType2 = func2 extends func1 ? func2 : never; //func2

type extractType1 = Extract<func1, func2>; //never
type extractType2 = Extract<func2, func1>; //(one: number) => string

// class 写法
class C1 {
  name = 'yuki';
  age = 18;
  color = 'yellow';
  school = 'da';
}

class C2 {
  name = 'yuki';
  age = 18;
}

// type 写法
type type1 = {
  name: string;
  age: number;
  color: string;
  school: string;
};

type type2 = {
  name: string;
  age: number;
};
// interface 写法
interface inter1 {
  name: string;
  age: number;
  color: string;
  school: string;
}

interface inter2 {
  name: string;
  age: number;
}

export { count };
